﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ChongJu.EventManager;
using ChongJu.EventManager.ExchangePage;

namespace ChoJu.Single.Views
{
    /// <summary>
    /// MenuView.xaml 的交互逻辑
    /// </summary>
    public partial class MenuView : UserControl
    {
        private bool _isView = false;

        public MenuView()
        {
            InitializeComponent();
            calibration.Visibility = Visibility.Collapsed;
        }

        private void home_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExchangePageEvent.OnExchangePageNew(PageEnum.Main);
        }

        private void camera_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExchangePageEvent.OnExchangePageNew(PageEnum.Camera);
        }

        private void collect_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExchangePageEvent.OnExchangePageNew(PageEnum.Collect);
        }

        private void calibration_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExchangePageEvent.OnExchangePageNew(PageEnum.Calibration);
        }

        private void UserControl_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var admin = new AdminView();
            admin.ShowDialog();
            if (admin.Sure == false)
            {
                calibration.Visibility = Visibility.Collapsed;
                _isView = false;
            }
            else
            {
                calibration.Visibility = Visibility.Visible;
                _isView = true;
            } 
        }

        private void grry_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExchangePageEvent.OnExchangePageNew(PageEnum.Grey);
        }

        private void weight_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ExchangePageEvent.OnExchangePageNew(PageEnum.Weight);
        }
    }
}
